﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RRHH.Entities;
using System.Data.SqlClient;
using System.Data;


namespace RRHH.DataAccess
{
    public class DAOCategoriaEmpleado
    {
        public List<BECategoriaEmpleado> ListarCategoriaEmpleado()
        {

            string sql = "SP_LISTAR_CATEGORIAEMPLEADO";

            SqlCommand sqlCommand = new SqlCommand();
            sqlCommand.CommandText = sql;

            using (DataAccess adoDataService = new DataAccess())
            {

                List<BECategoriaEmpleado> _BLCategoriaEmpleado = new List<BECategoriaEmpleado>();
                IDataReader dr = adoDataService.ExecuteReader(sqlCommand);

                while (dr.Read())
                {
                    BECategoriaEmpleado _BECategoriaEmpleado = new BECategoriaEmpleado();
                    _BECategoriaEmpleado.idAuto = Convert.ToInt32(dr["IDAUTO"]);
                    _BECategoriaEmpleado.descCategoria = Convert.ToString(dr["DESCCATEGORIA"]);
                    _BECategoriaEmpleado.estado = Convert.ToString(dr["ESTADO"]);
                    _BLCategoriaEmpleado.Add(_BECategoriaEmpleado);
                }
                dr.Close();

                adoDataService.Dispose();

                return _BLCategoriaEmpleado;
            }

        }
    }
}
